% 计算当前位置海拔高度 m
function h = getPosHeight(pos, lineStruct)
init_h = lineStruct.init_height;
h_ = init_h;
for j = 1:length(lineStruct.gradient)
    if pos >= lineStruct.gradient(j,1) && pos < lineStruct.gradient(j,2)
        h_ = h_ + (pos-lineStruct.gradient(j,1)).*lineStruct.gradient(j,3)/1000;
        break;
    else
        h_ = h_ + (lineStruct.gradient(j,2)-lineStruct.gradient(j,1))*lineStruct.gradient(j,3)/1000;
    end
end
h = h_;